package com.ny.aa.impl;

import com.ny.entity.Student;
import com.ny.aa.StudentService;
import com.ny.demo525.StudentDao;

import java.sql.SQLException;

public class StudentServiceImpl implements StudentService {
    // 修复点1: 添加 final；修复点2: 确保 StudentDaoImpl 存在并正确导入
    private final StudentDao studentDao = new StudentDaoImpl();

    public StudentServiceImpl() throws SQLException, ClassNotFoundException {
    }

    @Override
    public int add(Student student) throws SQLException, ClassNotFoundException {
        return studentDao.add(student);
    }

    @Override
    public Student login(String studentName, String studentPassword) throws SQLException, ClassNotFoundException {
        return studentDao.login(studentName, studentPassword);
    }

    private class StudentDaoImpl implements StudentDao {
        public StudentDaoImpl() throws SQLException, ClassNotFoundException {
        }
        @Override
        public int add(Student student) throws SQLException {
            return 0;
        }
        @Override
        public Student login(String studentName, String studentPassword) throws SQLException {
            return null;
        }
    }
    }

